﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using pwblog.DataAccess;
using pwblog.Entities;
using pwblog.Common;

namespace pwblog.BusinessObject
{
    public class CommentBo
    {
        private CommentDao commentDao;

        public CommentBo()
        {
            commentDao = new CommentDao();
        }

        
        /// <summary>
        /// add commnet vao bai viet
        /// </summary>
        /// <param name="cmt">doi tuong comment can add</param>
        internal bool AddComment(Entities.Comment cmt)
        {
            try
            {
                commentDao.InsertCommnet(cmt);
                return true;
            }
            catch
            {
                return false;
            }
        }

        internal Comment[] GetComments(int idArticle)
        {
            try
            {
                return commentDao.GetComments(idArticle);
            }
            catch
            {
                return null;
            }
        }
        internal CommentWithArticle[] GetCommentsWithRange(int skip, int take)
        {
            try
            {
                return commentDao.GetCommentsWithRange(skip, take);
            }
            catch
            {
                return null;
            }
        }
    }
}